package pl.nazaweb.imedproplus.model.entity;

import pl.nazaweb.imedproplus.model.interfaces.IDictionaryDefinition;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@Table(name = "dictionary_definition")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DictionaryDefinition.findAll", query = "SELECT d FROM DictionaryDefinition d"),
    @NamedQuery(name = "DictionaryDefinition.findById", query = "SELECT d FROM DictionaryDefinition d WHERE d.id = :id"),
    @NamedQuery(name = "DictionaryDefinition.findByName", query = "SELECT d FROM DictionaryDefinition d WHERE d.name = :name"),
    @NamedQuery(name = "DictionaryDefinition.findByTableName", query = "SELECT d FROM DictionaryDefinition d WHERE d.tableName = :tableName"),
    @NamedQuery(name = "DictionaryDefinition.findByValueColumn", query = "SELECT d FROM DictionaryDefinition d WHERE d.valueColumn = :valueColumn"),
    @NamedQuery(name = "DictionaryDefinition.findByNameColumn", query = "SELECT d FROM DictionaryDefinition d WHERE d.nameColumn = :nameColumn"),
    @NamedQuery(name = "DictionaryDefinition.findByWhereCriteria", query = "SELECT d FROM DictionaryDefinition d WHERE d.whereCriteria = :whereCriteria")})
public class DictionaryDefinition implements Serializable, IDictionaryDefinition {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name = "dictionary_sequence_", sequenceName = "dictionary_sequence", allocationSize=1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "dictionary_sequence_")
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 250)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 250)
    @Column(name = "table_name")
    private String tableName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 250)
    @Column(name = "value_column")
    private String valueColumn;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 250)
    @Column(name = "name_column")
    private String nameColumn;
    @Size(max = 250)
    @Column(name = "where_criteria")
    private String whereCriteria;

    public DictionaryDefinition() {
    }

    public DictionaryDefinition(Long id) {
        this.id = id;
    }

    public DictionaryDefinition(Long id, String name, String tableName, String valueColumn, String nameColumn) {
        this.id = id;
        this.name = name;
        this.tableName = tableName;
        this.valueColumn = valueColumn;
        this.nameColumn = nameColumn;
    }

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String getTableName() {
        return tableName;
    }

    @Override
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    @Override
    public String getValueColumn() {
        return valueColumn;
    }

    @Override
    public void setValueColumn(String valueColumn) {
        this.valueColumn = valueColumn;
    }

    @Override
    public String getNameColumn() {
        return nameColumn;
    }

    @Override
    public void setNameColumn(String nameColumn) {
        this.nameColumn = nameColumn;
    }

    @Override
    public String getWhereCriteria() {
        return whereCriteria;
    }

    @Override
    public void setWhereCriteria(String whereCriteria) {
        this.whereCriteria = whereCriteria;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DictionaryDefinition)) {
            return false;
        }
        DictionaryDefinition other = (DictionaryDefinition) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pl.nazaweb.imedproplus.model.entity.DictionaryDefinition[ id=" + id + " ]";
    }

}
